package lib.bone.admin.controller.nepu;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lib.bone.ext.draft.NepuDraftService;
import lib.bone.admin.anno.WebLog;
import lib.bone.admin.constant.MethodTypeConst;
import lib.bone.common.core.domain.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("nepu")
@Api(tags = "草稿管理")
public class DraftController {
    @Autowired
    NepuDraftService draftService;

    @WebLog(module = "nepu-access",operate = MethodTypeConst.DELETE)
    @DeleteMapping("draft/{id}")
    @ApiOperation(value = "根据ID删除草稿")
    public ResponseDTO deleteDraft(@PathVariable("id") String id){
        return draftService.deleteById(id);
    }

    @WebLog(module = "nepu-access",operate = MethodTypeConst.DELETE)
    @DeleteMapping("draft")
    @ApiOperation(value = "根据FormId删除草稿")
    public ResponseDTO deleteByFormId(String formId){
        return draftService.deleteByFormId(formId);
    }
}
